<%-------------------------------------------------------------------
 * 页面名称：lay.jsp
 * 功能描述：登录层页面
 * Action:  logon.do
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%
	String path = request.getContextPath();
	boolean needShowLogin = false;
	if (request.getAttribute("showLogin")!=null) {
		needShowLogin = true;
	}
	if (request.getSession().getAttribute("showLogin")!=null) {
		needShowLogin = true;
		request.getSession().removeAttribute("showLogin");
	}
	if(needShowLogin) {
%>
<style>
.LoginButtonCurrent {
	font-size: 12px;
	font-weight: bold;
	color: #FFFFFF;
	background-color: #0099CC;
	height: 23px;
	width: 65px;
	border: 0px;
}
.LoginButtonHover {
	font-size: 12px;
	font-weight: normal;
	color: #7F7F7F;
	background-color: #FFCC33;
	height: 23px;
	width: 65px;
	border: 0px;
}
.sys_processing_hide{
	position:absolute; 
	zIndex:1001;
	width:300px; 
	height:100px;
	left:50%; 
	top:50%;
	margin:-50px 0 0 -150px; 
	text-align:center ;
	background-image:url(<%=path%>/images/loading.gif);
	background-repeat: no-repeat;
	background-position: center;
	display:none;
}

.sys_processing_show{
	position:absolute; 
	zIndex:1001;
	width:300px; 
	height:100px;
	left:50%; 
	top:50%;
	margin:-50px 0 0 -150px; 
	text-align:center ;
	background-image:url(<%=path%>/images/loading.gif);
	background-repeat: no-repeat;
	background-position: center;
	display:block;
}

.sys_loading_hide{
	position:absolute; 
	zIndex:1001;
	width:300px; 
	height:100px;
	left:50%; 
	top:50%;
	margin:-50px 0 0 -150px; 
	text-align:center ;
	background-image:url(<%=path%>/images/loading-page.gif);
	background-repeat: no-repeat;
	background-position: center;
	display:none;
}

.sys_loading_show{
	position:absolute; 
	zIndex:1001;
	width:300px; 
	height:100px;
	left:50%; 
	top:50%;
	margin:-50px 0 0 -150px; 
	text-align:center ;
	background-image:url(<%=path%>/images/loading-page.gif);
	background-repeat: no-repeat;
	background-position: center;
	display:block;
}

.login_div_show {
	position:absolute; 
	cursor:move; 
	z-index:1001; 
	width: 332; 
	height: 262;
 	RIGHT: 341px;
 	TOP: 221px;
	text-align:center ;
	display:block;
}

.login_div_hide{
	position:absolute; 
	cursor:move; 
	z-index:1001; 
	width: 332; 
	height: 262;
 	RIGHT: 341px;
 	TOP: 221px;
	text-align:center ;
	display:none;
}
</style>
<div id="sys_processing" class="sys_processing_hide">

</div>

<div id="sys_loading" class="sys_loading_hide">

</div>

<script>
	function logon(type) {
		//alert(type);
		document.getElementById("logon_atype").value = type;
		
		if(type == "A") { //个人
			if(emptyValidate(getObj("logon_person_email"),"Email或手机") != "") {
				return false;
			}		
			if(emptyValidate(getObj("logon_person_passPerson"),"登录密码") != "") {
				
				return false;
			}
			if(emptyValidate(getObj("logon_person_sys_vericode"),"校验码") != "") {
				
				return false;
			}				
		} else if(type == "B") { //企业
			
			if(emptyValidate(getObj("logon_corp_email"),"Email") != "") {
				
				return false;
			}		
			if(emptyValidate(getObj("logon_corp_operator"),"操作员") != "") {
				
				return false;
			}
			if(emptyValidate(getObj("logon_corp_passCorp"),"登录密码") != "") {
				
				return false;
			}	
			if(emptyValidate(getObj("logon_corp_sys_vericode"),"校验码") != "") {
				
				return false;
			}		
		}
		document.getElementById("url").value=location.href;
		document.getElementById("from").value= document.getElementById("fromTemp").value;
		
		document.forms[0].submit();
	}
	
	function outLogon(ugroup) {
		if(validate(ugroup)) {
			setCookie(ugroup);
			showProcessing(); //显示进度条
			var value = parseObject(ugroup);
		    agiledata.userLogon(value,function(user){
				loading("<%=path%>/route.do?modual="+getValue('outModual'));
			});

		}
	}
	
	function showDiv(showDiv,hideDiv) {
		setDisplay(showDiv,'block');
		setDisplay(hideDiv,'none');
		
	}
	
	function refreshVericode(imgObjName) {
		var now = new Date();
		getObj(imgObjName).src = '<%=path%>/page/util/verifyImage.jsp?now='+now.getTime().toString();
	}

	// 切换tab显示
	function switchTab(id_num,num){
		for(var i=1;i<=2;i++) { 
			if(id_num==i) { 
				getObj('Tab_'+i).className='on'; 
				getObj('cont_'+i).style.display='';
			} 
			else { 
				getObj('Tab_'+i).className='off'; 
				getObj('cont_'+i).style.display='none'; 
			} 
		}
		// 刷新校验码
		refreshVericode('logon_sys_vericode_image'+num);
		getObj('logon_person_email').value='';
		getObj('logon_person_passPerson').value='';
		getObj('logon_person_sys_vericode').value='';
		getObj('logon_corp_email').value='';
		getObj('logon_corp_operator').value='';
		getObj('logon_corp_passCorp').value='';
		getObj('logon_corp_sys_vericode').value='';

		// 获得焦点
		if(num == 0) {
			getObj('logon_person_email').focus();
		}
		if(num == 1) {
			getObj('logon_corp_email').focus();
		}
	}

	function pers() {
		if(event.keyCode==13){
			logon('A');
		}
	}
	function corp() {
		if(event.keyCode==13){
			logon('B');
		}
	}
</script>


<% if (needShowLogin) { %>
<%
	String email = (String)request.getSession().getAttribute("email");
	if (email==null) {
		email = "";
	} else {
		request.getSession().removeAttribute("email");
	}
	String operator = (String)request.getSession().getAttribute("operator");
	if (operator==null) {
		operator = "";
	} else {
		request.getSession().removeAttribute("operator");
	}
%>
<link href="<%=path%>/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/font.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/newstyle.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/common.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.box {width:448px;margin:auto;border:1px solid #B77443;border-top:none;}
.off {margin-left:3px;line-height:34px;float:left;width:93px;height:34px;color:#003365;font-size:14px;font-weight:bold;text-align:center;background-image:url(<%=path%>/images/p_on.gif);cursor:pointer;}
.on {margin-left:3px;line-height:34px;float:left;width:93px;height:34px;color:#B77443;font-size:14px;font-weight:bold;text-align:center;background-image:url(<%=path%>/images/p_hover.gif);}
.tab {width:450px;margin:auto;float:left;background:url(<%=path%>/images/apply_bg.gif) top left no-repeat}
-->
</style>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle"><br />
        <br />
        <br />
        <br />
        <br />
		<form action="<%=path%>/logon.do" method="post">
		<input type="hidden" name="logon_atype"  id="logon_atype"/>
		<input type="hidden" id="url" name="url"/>
		<input type="hidden" id="from" name="from"/>
        <table width="450" height="300" cellpadding="0" >
        <tr>
          <td align="center" valign="top" bgcolor="#FFFFFF">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
          		<tr> 
            		<td width="93%" height="26" align="center"  class="text9white">对不起，你还没有登录，请先登录！</td>
            		<td width="7%" align="center"  id="closeLayTd">
					</td>
          		</tr>
        	</table> 
			<div class="tab">
			  <div class="on" id="Tab_1" onclick="switchTab('1',0);">个人登录</div>
			  <div class="off" id="Tab_2" onclick="switchTab('2',1);">企业登录</div>
			</div>
			<!-- 个人登录区域开始 begin -->
            <div class="box" id="cont_1" onKeyDown="pers()">
			<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1">
			  <tr>
				<td height="25" colspan="2" align="right">&nbsp;</td>
				</tr>
				<tr>
				  <td height="25" align="right">Email或手机：</td>
				  <td align="left" bgcolor="#FFFFFF">
					<input name="logon_person_email" type="text" class="login_inputsytle" maxlength="100"  onblur="killSpace(this);"/>
				  </td>
				  </tr>
				<tr>
				  <td width="24%" height="25" align="right">登 录 密 码：</td>
				  <td width="76%" align="left" bgcolor="#FFFFFF">
					<input name="logon_person_passPerson" type="password" class="login_inputsytle" maxlength="64"  onblur="killSpace(this);"/>
				  </td>
				  </tr>
				<tr>
				  <td height="25" align="right">校　验　码：</td>
				  <td align="left" bgcolor="#FFFFFF">
				  <input name="logon_person_sys_vericode" maxlength="4" type="text" size="4" onblur="killSpace(this);" utext="校验码" uregular="UValidate.notEmpty"/>
				<img name="logon_sys_vericode_image0" src="<%=path%>/page/util/verifyImage.jsp" width="60" height="24" align="absmiddle" />
				&nbsp;<img class="arrowPosi" src="<%=path%>/page/information/images/reset.gif" width="13" height="12" align="absmiddle" style="cursor:hand;" title="看不清校验码请点击此图标刷新！" onclick="javascript:refreshVericode('logon_sys_vericode_image0');" />
				  </td>
				  </tr>
				<tr>
				  <td height="25" align="right">&nbsp;</td>
				  <td align="left" bgcolor="#FFFFFF">
				  <input name="login" type="button" class="graybutton_style" value="登 录" onclick="logon('A')"  />
				  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input name="toRegister" type="button" class="graybutton_style" value="注 册" onclick="location='<%=path%>/toRegister.do'"/>
					</td>
				</tr>
				<tr>
				  <td height="25" colspan="2" align="center">
				  <a href="<%=path%>/toActimail.do" class="dropblue12b">重发激活信</a>　
				  <a href="<%=path%>/toActivate.do" class="dropblue12b">填写激活码 </a>　
				  <a href="<%=path%>/toForgot.do" class="dropblue12b">忘记密码了</a></td>
				  </tr>
			</table>
			</div>
			<!--  个人用户登录区域 end -->
			<!-- 企业用户登录区域开始 -->
		  <div class="box" id="cont_2" style="display:none;" onKeyDown="corp()">
			<input type="hidden" name="logon_corp_atype" value="B"/>
			<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1">
			  <tr>
				<td height="25" colspan="2" align="right">&nbsp;</td>
			  </tr>
				<tr>
				  <td height="25" align="right">Email：</td>
				  <td align="left" bgcolor="#FFFFFF">
					<input name="logon_corp_email" type="text" class="login_inputsytle" maxlength="100" onblur="killSpace(this);"/>
				  </td>
				</tr>
				<tr>
				  <td height="25" align="right">操　作　员：</td>
				  <td align="left" bgcolor="#FFFFFF">
					<input name="logon_corp_operator" type="text" class="login_inputsytle" maxlength="64" onblur="killSpace(this);"/>
				  </td>
				</tr>
				<tr>
				  <td width="24%" height="25" align="right">登 录 密 码：</td>
				  <td width="76%" align="left" bgcolor="#FFFFFF">
					<input name="logon_corp_passCorp" type="password" class="login_inputsytle" onblur="killSpace(this);"/>
				  </td>
				</tr>
				<tr>
				  <td height="25" align="right">校　验　码：</td>
				  <td align="left" bgcolor="#FFFFFF">
					<input name="logon_corp_sys_vericode" maxlength="4" type="text" size="4" onblur="killSpace(this);" utext="校验码" uregular="UValidate.notEmpty"/>
					<img name="logon_sys_vericode_image1" src="<%=path%>/page/util/verifyImage.jsp" width="60" height="24" align="absmiddle" />
					&nbsp;<img class="arrowPosi" src="<%=path%>/page/information/images/reset.gif" width="13" height="12" align="absmiddle" style="cursor:hand;" title="看不清校验码请点击此图标刷新！" onclick="javascript:refreshVericode('logon_sys_vericode_image1');" />
				  </td>
				</tr>
				<tr>
				  <td height="25" align="right">&nbsp;</td>
				  <td align="left" bgcolor="#FFFFFF">
				  <input name="login" type="button" class="graybutton_style" value="登 录" onclick="logon('B')" />
					  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input name="login" type="button" class="graybutton_style" onclick="location='<%=path%>/toCompanyRegister.do'" value="注 册" />
					</td>
				</tr>
				<tr>
				  <td height="25" colspan="2" align="center">
				  <a href="<%=path%>/toActimail.do" class="dropblue12b">重发激活信</a>　
				  <a href="<%=path%>/toActivate.do" class="dropblue12b">填写激活码 </a>　
				  <a href="<%=path%>/toForgot.do" class="dropblue12b">忘记密码了</a></td>
				</tr>
			</table>
		  </div>
		  <!-- 企业用户登录区域结束 -->
		</td>
		</tr>
	</table>
	</td>
	</tr>
</table>
</form>
</div>
<%
	if (!operator.equals("")) {
%>
	<script language="javascript">
		switchTab('2',1);
		getObj('logon_corp_email').value='<%=email%>';
		getObj('logon_corp_operator').value='<%=operator%>';
	</script>
<%
	} else if (!email.equals("")) {
%>
	<script language="javascript">
		getObj('logon_person_email').value='<%=email%>';
		getObj('logon_person_email').focus();
	</script>
<%
	}
%>
<%
	}
%>

<%}%>